package opencv.core.AddingImages;

import opencv.utils.InitUtils;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.highgui.HighGui;
import org.opencv.imgcodecs.Imgcodecs;

import java.util.Locale;
import java.util.Scanner;

/**
 * 相同大小图片合并显示
 */
public class ReadImages {
    public static void main(String[] args) {
        InitUtils.addLibrary();
        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
        new ReadImages().run();
    }

    public void run() {
        //调节图片显示强度
        Mat dst ,dst1,dst2 = new Mat();

        System.out.println(" Simple Linear Blender ");
        System.out.println("-----------------------");
        System.out.println("* Enter alpha [0.0-1.0]: ");
        Scanner scan = new Scanner( System.in ).useLocale(Locale.US);
        dst = Imgcodecs.imread("./src/main/resources/images/lena.jpg",Imgcodecs.IMREAD_GRAYSCALE);
        dst1 = Imgcodecs.imread("./src/main/resources/images/lena.jpg",Imgcodecs.IMREAD_UNCHANGED /*不改变图像类型，可能包含透明通道*/);
        dst2 = Imgcodecs.imread("./src/main/resources/images/lena.jpg",Imgcodecs.IMREAD_ANYDEPTH);
        //! [load]

        //![display]
        HighGui.imshow("灰色", dst);
        HighGui.imshow("彩色", dst1);
        HighGui.imshow("Linear Blend", dst2);
        HighGui.waitKey(0);
        //![display]

        System.exit(0);
    }
}
